local ceci = fk.CreateSkill{
    name = "wk_heg__ceci",
}

Fk:loadTranslationTable{
    ["wk_heg__ceci"] = "册辞",
    [":wk_heg__ceci"] = "每轮结束时，你可将手牌摸至体力上限，然后若存在与你势力相同且拥有〖制衡〗的角色，其获得〖黄龙〗，你变更此武将牌。",

    ["#wk_heg__ceci-choose"] = "册辞：选择一名与你势力相同且拥有〖制衡〗的角色，其获得〖黄龙〗",

    ["$wk_heg__ceci1"] = "无传书卷记，功过自有评",
    ["$wk_heg__ceci2"] = "佚以典传，千秋谁记？",
}

local H = require "packages/ol_hegemony/util"

ceci:addEffect(fk.RoundEnd,{
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
      return player:hasSkill(ceci.name)
  end,
  on_use = function(self, event, target, player, data)
      local room = player.room
      if player:getHandcardNum() < player.maxHp then
        player:drawCards(player.maxHp - player:getHandcardNum(), ceci.name)
      end
      local targets = table.filter(room.alive_players, function(p)
        return H.compareKingdomWith(p, player) and (p:hasSkill("wk_heg__zhiheng") or p:hasSkill("hs__zhiheng")
        or p:hasSkill("ld__lordsunquan_zhiheng") or p:hasSkill("luminous_pearl_skill")) 
      end)
      if #targets > 0 then
      local tos = room:askToChoosePlayers(player,{
        targets = targets,
        min_num = 1,
        max_num = 1,
        prompt = "#wk_heg__ceci-choose",
        skill_name = ceci.name,
        cancelable = false,
      })
      local to = tos[1]
      room:handleAddLoseSkills(to, "wk_heg__huanglong")
      if not H.inGeneralSkills(player, ceci.name) then return end
      local isMain = player.general == "wk_heg__sunshao" and true or false
      H.transformGeneral(player, isMain, 3, false)
    end
  end,
})

return ceci